using System;
using KsWare.Breconium.Core.ProtocollData;

namespace KsWare.Breconium.Core {

	public class Command:TraceableObject {
		
		private string mName;
		private object mArguments;
		private Json mResult;
		private bool mHasError;
		private Json mError;

		public Command() {}

		public Command(string name):this(name,null) { }

		public Command(string name, object arguments) { 
			Name=name;
			Arguments = arguments;
		}

		private CommandState mState;
		public CommandState State { get { return mState; } set { mState = value; Trace("State",value); } }

		public string Name { get { return mName; } set { mName = value; } }
		public object Arguments { get { return mArguments; } set { mArguments = value; } }
		public Json Result { get { return mResult; } set { mResult = value; } }
		public bool   HasError { get { return mHasError; } set { mHasError = value; } }
		public Json Error { get { return mError; } set { mError = value; } }

		public MessageData Message { get; set; }
	}

	public enum CommandState {
		None,
		S1_Enqueued,
		S2_Sent,
		S2b_Acknowledged,
		S3_ResponseReceived
	}

}